<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="/common/common.jspf"%>
<script type="text/javascript" src="${ctx}/js/device/type/type_part.js">
</script>
<style type="text/css">
label[class^="btn btn-default"] {
	margin-top: -4px;
}

	table,td {
		text-align: center;
		/*vertical-align:middle;*/
		/*border-style: solid*/
	}
	table,th {
		text-align: center;
		/*vertical-align:middle;*/
		/*border-style: solid*/
	}
</style>
</head>
<body>
<form id="form" name="form" class="form-horizontal" method="post"
      action="${ctx}/devicetype/devicetype_editpart.shtml">
    <section class="panel panel-default">
        <div class="panel-body">

            <input type="hidden" value="${user.deviceTypeId}" name="deviceTypeId" id="deviceTypeId">
            <input type="hidden" value="${user.deviceTypeName}" name="deviceTypeName" id="deviceTypeName">

            <div class="l_err" style="width: 100%; margin-top: 2px;"></div>
            <table class="table table-bordered"  style="width: 90%;margin: 0px auto; " >
                <thead>
                <tr>
                    <th style="text-align: center; width:135px;">保养部位(${user.deviceTypeName})</th>
                    <th style="text-align: center; width:135px;">
                        <input type="button" class="btn btn-primary" onclick="insert_row(this)" value="增加">
                    </th>
                </tr>
                </thead>
                <tbody id="tbl">
                    <c:forEach items="${list}" var="ls">
                        <tr>
                            <%--<td><c:choose>--%>
                                <%--<c:when test="${ls.deviceName == 1}">--%>
                                    <%--IQC--%>
                                <%--</c:when>--%>
                            <%--</c:choose></td>--%>
                            <%--<td>${ls.ly_domain}</td>--%>
                            <td>
                                <input type="text" style="text-align: center;" class="form-control" value="${ls.devMaintenancePartName}" name="ly_dev_part" id="ly_dev_part">
                            </td>
                            <td>
                                <input type="button" class="btn btn-danger" onclick ="deleteRow(this)" value ="删除">
                            </td>
                        </tr>
                    </c:forEach>
                </tbody>
            </table>
        </div>
        <footer class="panel-footer text-right bg-light lter">
            <button type="submit" class="btn btn-success btn-s-xs">修改保养部位</button>
        </footer> </section>
</form>

	<script type="text/javascript">
		// onloadurl();
        // var i = 0


        function insert_row(obj) {
            var tb1 = document.getElementById("tb1");
            // i++;
            R = tbl.insertRow(tbl.rows.length);
            C = R.insertCell(0);
            C.innerHTML = '<input type="text" class="form-control" name="ly_dev_part" id="ly_dev_part">';
            C = R.insertCell(1);
            // C.innerHTML = '<div class="input-group"><input type="text" class="form-control" name="ly_dev_describe" id="ly_dev_describe"></div>';
            // C = R.insertCell(2);
            C.innerHTML = '<input type="button" class="btn btn-danger" onclick ="deleteRow(this)" value ="删除">';
        }

        function deleteRow(obj) {
            var i = obj.parentNode.parentNode.rowIndex;
            if (i > 0) {
                tbl.deleteRow(i-1);
            }
        }
	</script>
	<script type="text/javascript" src="${ctx}/notebook/notebook_files/bootstrap-filestyle.min.js"></script>
</body>
</html>